package GenderCount.daoimpl;


import GenderCount.dao.Dao;
import GenderCount.util.HiveUtil;
import GenderCount.vo.Show_Data;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class DaoImpl implements Dao {


    public Show_Data getTotalCount() {
        String sql = "SELECT  gender,total_count FROM ads_stu_info";
        ResultSet rs = HiveUtil.getRS(sql);
        List<String> genders = new ArrayList<String>();
        List<Double>  total_counts = new ArrayList<Double>();

        Show_Data show_data = null ;
        try {
            while (rs.next()){
                String gender = rs.getString(1);
                Double total_count = rs.getDouble(2);


                genders.add(gender);
                total_counts.add(total_count);


            }
            show_data = new Show_Data(genders, total_counts );
        }catch (Exception e){
            e.printStackTrace();
        }
        return show_data;
    }

}

